<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <script type="text/javascript" src="../../inc/ctx.jsp"></script>
        <script type="text/javascript" src="../js/g.js"></script>
        <script type="text/javascript" src="../js/channeltype.js"></script>
        <link href="../css/com.css" type="text/css" rel="stylesheet"/>
        <style>
            b.b1{display:block;padding:1px 5px 1px 5px;border:1px solid #E0E0E0;}
        </style>
    </head>
    <body>
        <div id="panel">
            <form id="queryFrm">
                <table border="0" cellspacing="0" cellpadding="0">
                    <tr class="trhd">
                        <td colspan="3"><h3 class="s1">微评查询</h3></td>
                        <td width="7%">&nbsp;</td>
                        <td colspan="3">&nbsp;</td>
                    </tr>
                    <tr>
                        <td width="2%" height="34">&nbsp;</td>
                        <td width="7%" class="r">发布状态：</td>
                        <td width="23%">
                            <select id="pubstate" name="pubstate" style="width:100px;">
                                <option value=""></option>
                                <option value="1">1-是-</option>
                                <option value="0">0-否-</option>
                            </select>
                            <span class="r">
                                <input onClick="Cmt.updatePubState();" type="button" id="updateBtn1" value="更新">
                            </span></td>
                        <td class="r">发布时间：</td>
                        <td width="27%">
                            从 <input type="text" id="pubBeginTime" name="pubBeginTime" value="" maxlength="19" style="width:100px;" onclick="cdpn('pubBeginTime');"/>
                            到 <input type="text" id="pubEndTime" name="pubEndTime" value="" maxlength="19" style="width:100px;"  onclick="cdpn('pubEndTime');"/>
                        </td>
                        <td width="9%" class="r">&nbsp;</td>
                        <td><input name="rownum" id="rownum" value="" type="hidden" />
                            <input name="crow" id="crow" value="" type="hidden" />
                            <input name="currpage" id="currpage" value="" type="hidden" /></td>
                    </tr>
                    <tr>
                        <td height="33">&nbsp;</td>
                        <td class="r">ID：</td>
                        <td>
                            <input type="text" id="id" name="id" value=""  style="width:120px;"  onClick="this.value=''"/></td>
                        <td class="r">板块类别：</td>
                        <td>&nbsp;<script>out_select('channeltype');</script></td>
                        <td class="r">关联ID：</td>
                        <td><input name="relateid" id="relateid" value="" type="text" maxlength="18" onClick="this.value=''"/></td>
                    </tr>
                    <tr>
                        <td height="33">&nbsp;</td>
                        <td class="r">支持次数：</td>
                        <td>从
                            <input type="text" id="beginTopHitNum" name="beginTopHitNum" value=""  style="width:50px;" onClick="this.value=''"/>
                            到
                            <input type="text" id="endTopHitNum" name="endTopHitNum" value=""  style="width:50px;" onClick="this.value=''"/></td>
                        <td class="r">每页显示：</td>
                        <td><select name="listsize" id="listsize">
                                <option value="10">10条</option>
                                <option value="20">20条</option>
                                <option value="50">50条</option>
                            </select></td>
                        <td class="r">&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td height="33">&nbsp;</td>
                        <td class="r">被踩次数：</td>
                        <td>从
                            <input type="text" id="beginStepHitNum" name="beginStepHitNum" value=""  style="width:50px;" onClick="this.value=''"/>
                            到
                            <input type="text" id="endStepHitNum" name="endStepHitNum" value=""  style="width:50px;" onClick="this.value=''"/></td>
                        <td class="r">昵称：</td>
                        <td><input id="nickKeyword" name="nickKeyword" value="" maxlength="20" style="width:120px;" onClick="this.value=''"/></td>
                        <td class="r">&nbsp;</td>
                        <td><span class="r">
                                <input onClick="Cmt.list(1, 0);" type="button" class="button small orange" id="submitBtn" value="Φ 查询">
                                <input onClick="Cmt.del();" type="button" class="button small gray" id="delBtn" value="x 删除">
                            </span></td>
                    </tr>
                </table>
            </form>
        </div>


        <div class="databox">
            <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <th width="5%">&nbsp;<a href="javascript:ut.swapsel('sel');">反选</a></th>
                    <th width="64%">评论</th>
                    <th width="7%">审核发布</th>
                    <th width="12%">板块/关联ID</th>
                    <th width="12%">顶/踩次数</th>
                </tr>
                <tbody class="tbchg" id="datalist"></tbody>
            </table>
        </div>
        <div class="page" id="page"></div>

        <div style="display:block;clear:both;width:98%;height:50px;">&nbsp;</div>





        <!-- 数据处理 -->
        <script id="listTpl" type="text/html">
            {%  for(var k in list){ var e = list[k]; %}
        <tr>
            <td><input name="sel" type="checkbox" value="{%=e.id%}"/></td>
            <td>
                <b>{%=e.nick%}</b><span class="s1"> (id: {%=e.id%} , ip: {%=e.ip%}, time: {%=parseDate(e.pubtime,16)%})</span>
                <p style="line-height:21px;color:#039;">{%=e.content%}</p>
            </td>
            <td><b>{%=getPubState(e.pubstate)%}</b></td>
            <td>{%=getChannelType(e.channeltype)%} <br/> {%=e.relateid%}</td>
            <td>{%=formatHitNum(e.tophitnum,0)%}<br/>{%=formatHitNum(e.stephitnum,1)%} </td>
        </tr>
        {%}%}
    </script>

    <script type="text/javascript">
        var $lsout = $('#datalist');
        var $ls = $('#listsize');
        var $rownum = $('#rownum');
        var $crow=$('#crow');
        var $curpage=$('#currpage');
        var Cmt={
            list:function(pgno,r){
                var ls = parseInt($ls.val());
                var step =10;
                var cr = (ls * ( pgno - 1 ));
                $rownum.val(r);
                $crow.val(cr);
                $curpage.val(pgno);
                var params = ut.getFormData('#queryFrm');
                params._t=ut.r();
                $.get('../app/tinycmt/list_factor.shtm',params,function(d){
                    var x = d;
                    rn=x.rownum;
                    $rownum.val(rn);
                    if(rn>0){
                        ut.outpage(pgno, rn, 'Cmt.list','page', ls, step);
                        $lsout.html(template.render('listTpl',x));
                    }else{
                        $lsout.html('<tr><td colspan="8">暂无数据.</td></tr>');
                        $('#page').html('');
                    }
                }
            );
            },
            del:function(){
                var ida = ut.getselv('sel');
                if(va.isnull(ida)){ut.m('请选择需要删除的信息.');return;}
                if(!window.confirm("确定删除么?执行后不可恢复."))return;
                $.get('../app/tinycmt/delete_batch.shtm?t='+ut.r(), "ids="+ida, function(x){
                    var r = $.trim(x);
                    if(va.tint(r)){
                        ut.m('删除成功.已删除记录数为'+r);
                        Cmt.list($curpage.val(),0);
                    }else{
                        ut.m('删除失败. '+r);
                    }
                });
            },
            updatePubState:function(){
                var ida = ut.getselv('sel');
                if(va.isnull(ida)){ut.m('请选择需要更新的信息.');return;}
                var st = $('#pubstate').val();
                if(va.isnull(st)){ut.m('请选择发布状态.');return;}
                var p = {'ids':ida,'pubstate':st};
                $.get('../app/tinycmt/update_pubstate.shtm',$.param(p), function(x){
                    var r = $.trim(x);
                    if(va.tint(r)){
                        ut.m('更新成功.已更新记录数为'+r);
                        Cmt.list($curpage.val(),0);
                    }else{
                        ut.m('更新失败. '+r);
                    }
                });
            }
        };
            
        function formatHitNum(v,k){
            return k==0?'<span style="color:blue;font-size:14px;">↑'+v+'</span>' : '<span style="color:red;font-size:14px;">↓'+v+'</span>';
        };
        
        template.helper('parseDate',ut.parseDate);
        template.helper('formatHitNum',formatHitNum);
        template.helper('getChannelType',getChannelType);
        template.helper('getPubState',getPubState);
    </script>
</body>
</html>
